﻿using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Text;

namespace System
{
	public partial class ProcessMemory
	{
		public Process P;
		public ProcessMemory()
		{
		}
		public void AttachProcess(String proc)
		{
			try
			{
				P = Process.GetProcessesByName(proc)[0];
				OpenProcess();
			}
			catch (Exception e)
			{
				Handle = 0;
				Console.WriteLine("ATTACH ERROR: " + e.StackTrace);
			}
		}
		public ProcessMemory(String proc)
		{
			AttachProcess(proc);
		}
		public ProcessMemory(Process p)
		{
			P = p;
			OpenProcess();
		}
		public void InitProcess(String FN, String WD)
		{
			P = new Process();
			P.StartInfo.FileName = FN;
			P.StartInfo.WorkingDirectory = WD;
		}
		public void Start()
		{
			P.Start();
		}
	}
}